<template>
	<view class="">
		<view class="bgf mb24 nav" :style="[h]">
			<u-tabs :list="tab_list" lineWidth='64rpx' lineHeight='6rpx' lineColor="#2A71C0" :activeStyle="{
			            color: '#2A71C0',
						fontSize: '26rpx',
						transform: 'scale(1.05)'
			        }" :inactiveStyle="{
			            color: '#666666',
						fontSize: '26rpx',
						transform: 'scale(1)'
			        }" itemStyle="width: 27%;height: 81rpx" :current="current" @change="selectOrder">
			</u-tabs>
		</view>
		<view class="">
			<view class="" v-if="list.length>0">
				<view class="br12 bgf m2432 p24" v-for="item in list" @click="orderDetails(item)">
					<view class="flex btw">
						<view class="">
							<view class="fs28 c3 fw500">{{item.address.contact}} {{item.address.telephone}}</view>
							<view class="fs24 c9 fw500">{{item.address.province}}{{item.address.city}}
								{{item.address.district}}{{item.address.address}}
							</view>
						</view>
						<image class="img40" src="/static/classify/tel.png" mode="" @click.stop="calltel(item)"></image>
					</view>
					<view class="cut_line mtb24"></view>

					<view class="">
						<view class="fs28 c2a7 pb10 fw500">
							<view v-if="current == 0">等待送货员送回</view>
							<view v-if="current == 1">等待用户取货</view>
							<view v-if="current == 2">已完成</view>
						</view>
						<view class="flex btw">
							<view class="flex1 flex">
								<view class="" v-for="itema in item.goods">
									<image class="img120 br12" :src="itema.image_str" mode="">
									</image>
									<view class="fs24 c3 sn1">{{itema.goods_name}}</view>
								</view>
							</view>
							<view class="ml10 right flex_x flex_y_end">
								<view class="pr10 fs22 c9">共{{item.total}}件</view>
								<view class="mt4">
									<u-icon name="arrow-right" color="#909090" size="24rpx"></u-icon>
								</view>
							</view>
						</view>
						<view class="cut_line mtb24"></view>
					</view>

					<view class="">
						<view class="flex_btw mb10">
							<view class="fs28 fw500 c3">本单预计收入</view>
							<view class="fw500 cfe4">
								<text class="fs24">￥</text>
								<text class="fs32">{{item.revenue_text}}</text>
							</view>
						</view>
						<view class="mb10 flex_x">
							<view class="fs24 c9 fw600 mr24">订单编号</view>
							<view class="fs24 c3 fw600 mr10">{{item.sn}}</view>
							<view class="flex_x" @click.stop="fz(item.sn)">
								<image class="img32" src="/static/sever/fz.png" mode=""></image>
							</view>
						</view>
						<view class="flex_x">
							<view class="fs24 c9 fw600 mr24">下单时间</view>
							<view class="fs24 c3 fw600">{{item.createtime_text}}</view>
						</view>
					</view>
					<view class="" v-if="current == 1 || current == 2">
						<view class="cut_line mtb24"></view>
						<view class="">
							<view class="flex_x">
								<view class="fs24 c9 fw600 mr40">取货码</view>
								<view class="fs24 c3 fw600">x67A</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="" v-else>
				<u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/order.png">
				</u-empty>
			</view>

		</view>
	</view>
</template>

<script>
	import tool from '../../../../utils/tool/tool.js'
	export default {
		components: {},
		data() {
			return {
				tab_list: [{
					name: '送回中'
				}, {
					name: '待归还'
				}, {
					name: '已完成'
				}],
				h: {},
				current: 0, //标识
			}
		},
		onLoad() {

		},
		onShow() {

		},
		mounted() {
			uni.getSystemInfo({
				success: (e) => {
					let statusBar = 0 //状态栏高度
					let customBar = 0 // 状态栏高度 + 导航栏高度  
					let navbar = 0 // 自定义标题与胶囊对齐高度
					statusBar = e.statusBarHeight
					const custom = wx.getMenuButtonBoundingClientRect()
					customBar = custom.bottom + custom.top - e.statusBarHeight
					navbar = (custom.top - e.statusBarHeight) * 2 + custom.height
					this.h = {
						top: statusBar + 44 + 'px'
					}
					// console.log(this.h);
				}
			})
		},
		methods: {
			selectOrder(e) { //选择订单状态
				this.current = e.index;
				this.$parent.getServerOrderList(e.index + 6);
			},
			toPath(e) {
				// 1订单详情
				uni.navigateTo({
					url: `/pages/server/getOrder/washdetail/washdetail?type=1?type=${this.current}&id=${item.id}`
				})
			},
			calltel(item) { //打电话
				uni.makePhoneCall({
					phoneNumber: item.address.telephone //拨打电话
				});
			},
			fz(value) { //复制
				tool.copyText(value)
			},
			
		},
		computed: {

		},
		watch: {

		}
	}
</script>

<style lang="scss" scoped>
	.nav {
		position: sticky;
		top: 0;
		z-index: 99;
		border-top: 1upx solid rgba(0, 0, 0, 0.1);
	}

	.right {
		width: 120upx;
	}
</style>
